from django.contrib import admin

# Needed from NoPBX
from nopbx.schedule.models import Day, Week, Holiday, Calendar

###############################################################################

class DayAdmin(admin.ModelAdmin):
    """
    """
    list_display = ('name', 'description', 'start', 'end')

    fieldsets = [
        (None, {'fields': ['name', 'description', 'start', 'end']}),
    ]

admin.site.register(Day, DayAdmin)



###############################################################################

class WeekAdmin(admin.ModelAdmin):
    """
    """
    list_display = ('name', 'description')

    fieldsets = [
        (None, {'fields': ['name', 'description']}),
        ('Daily Schedules', {'fields': ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']}),
   ]

admin.site.register(Week, WeekAdmin)



###############################################################################

class HolidayAdmin(admin.ModelAdmin):
    """
    """
    list_display = ('name', 'description', 'start', 'end')

    fieldsets = [
        (None, {'fields': ['name', 'description']}),
        ('Date range', {'fields': ['start', 'end']}),
    ]

admin.site.register(Holiday, HolidayAdmin)



###############################################################################

class CalendarAdmin(admin.ModelAdmin):
    """
    """
    list_display = ('name', 'description')
    filter_horizontal = ('holidays',)

    fieldsets = [
        (None, {'fields': ['name', 'description', 'week']}),
        ('Holidays', {'fields': ['holidays']}),
    ]

admin.site.register(Calendar, CalendarAdmin)

